loongarch: add loongarch64 support for proot #382
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
add loongarch64 support.
To make it function correctly, we need to disable -O2 optimization in GNUmakefile or using
__attribute__((optimize("O2")))
inloader.c
_start
function, same as the riscv64 port. Also, we can not using gdb in proot, it will crash directly on kernel version 6.x, or failed to run on kernel 4.19.Update:
After fixing
assembly-loongarch.h
according the way nolibc build its syscall macro, which is add$t0
~$t8
to clobber list and make result from=r
(read-only) to+r
(read write), now proot can run correctly underO2
optimize level.Reference:
LoongArch nolibc header: https://github.com/torvalds/linux/blob/master/tools/include/nolibc/arch-loongarch.h